@model Adams.Admin.DataTransfer.DailyPrayers.CreatePrayer.PageLoad
@{
    Layout = "~/Views/DailyPrayers/_Layout.cshtml";
}
<div class="content-box">
    <!-- Start Content Box -->
    <div class="content-box-header">
        <h3>
            @Model.Location.Name - @Adams.Shared.DateHelper.GetMonthNameByNumber(Model.Month)</h3>
    </div>
    <!-- End .content-box-header -->
    <div class="content-box-content">
        <form action="" method="post">
        <input class="button align-right" id="generateprayer" type="button" value="Generate Prayer Times" />
        <input class="button" id="save" type="button" value="Save" />
        <div align="center">
            @for (int i = 1; i <= 12; i++)
            {
                <a href="/DailyPrayers/CreatePrayer/@Model.Location.ID?month=@i" @(Model.Month == i ? @"class=sel" : "")>@Adams.Shared.DateHelper.GetMonthShortNameByNumber(i)</a>
            }
        </div>
        <div class="clear">
        </div>
        <br />
        <table id="timestable">
            <tr>
                <th>
                    Day
                </th>
                <th>
                    Fajr
                </th>
                <th>
                    Iqama
                </th>
                <th>
                    Sunrise
                </th>
                <th>
                    Duhr
                </th>
                <th>
                    Iqama
                </th>
                <th>
                    Asr
                </th>
                <th>
                    Iqama
                </th>
                <th>
                    Maghrib
                </th>
                <th>
                    Iqama
                </th>
                <th>
                    Isha
                </th>
                <th>
                    Iqama
                </th>
            </tr>
            @{
                int DaysInMonth = System.DateTime.DaysInMonth(DateTime.Now.Year, Model.Month);}
            @for (int day = 1; day <= DaysInMonth; day++)
            {
                var time = Model.Location.PrayerTimes.Where(t => t.Month == Model.Month && t.Day == day).FirstOrDefault();
                string f = string.Empty;
                string fi = string.Empty;
                string s = string.Empty;
                string z = string.Empty;
                string zi = string.Empty;
                string a = string.Empty;
                string ai = string.Empty;
                string m = string.Empty;
                string mi = string.Empty;
                string i = string.Empty;
                string ii = string.Empty;
                if (time != null)
                {
                    f = time.Fajr;
                    fi = time.FajrIqama;
                    s = time.Sunrise;
                    z = time.Duhr;
                    zi = time.DuhrIqama;
                    a = time.Asr;
                    ai = time.AsrIqama;
                    m = time.Maghrib;
                    mi = time.MaghribIqama;
                    i = time.Isha;
                    ii = time.IshaIqama;
                }
                <tr>
                    <td>@day
                    </td>
                    <td>
                        <input id="Fajr@(day)" type="text" value="@f" style="width: 3em;" class="align-left" />
                    </td>
                    <td>
                        <input id="FajrIqama@(day)" type="text" value="@fi" style="width: 3em;" class="align-left" />
                        <span id="r_FajrIqama_@(day)" class="ui-icon ui-icon-arrowthick-1-s clickable" title="copy to below">
                        </span>
                    </td>
                    <td>
                        <input id="Sunrise@(day)" type="text" value="@s" style="width: 3em;" class="align-left" />
                    </td>
                    <td>
                        <input id="Duhr@(day)" type="text" value="@z" style="width: 3em;" class="align-left" />
                    </td>
                    <td>
                        <input id="DuhrIqama@(day)" type="text" value="@zi" style="width: 3em;" class="align-left" />
                        <span id="r_DuhrIqama_@(day)" class="ui-icon ui-icon-arrowthick-1-s clickable" title="copy to below">
                        </span>
                    </td>
                    <td>
                        <input id="Asr@(day)" type="text" value="@a" style="width: 3em;" class="align-left" />
                    </td>
                    <td>
                        <input id="AsrIqama@(day)" type="text" value="@ai" style="width: 3em;" class="align-left" />
                        <span id="r_AsrIqama_@(day)" class="ui-icon ui-icon-arrowthick-1-s clickable" title="copy to below">
                        </span>
                    </td>
                    <td>
                        <input id="Maghrib@(day)" type="text" value="@m" style="width: 3em;" class="align-left" />
                    </td>
                    <td>
                        <input id="MaghribIqama@(day)" type="text" value="@mi" style="width: 3em;" class="align-left" />
                        <span id="r_MaghribIqama_@(day)" class="ui-icon ui-icon-arrowthick-1-s clickable" title="copy to below">
                        </span>
                    </td>
                    <td>
                        <input id="Isha@(day)" type="text" value="@i" style="width: 3em;" class="align-left" />
                    </td>
                    <td>
                        <input id="IshaIqama@(day)" type="text" value="@ii" style="width: 3em;" class="align-left" />
                        <span id="r_IshaIqama_@(day)" class="ui-icon ui-icon-arrowthick-1-s clickable" title="copy to below">
                        </span>
                    </td>
                </tr>
            }
        </table>
        <div class="clear">
        </div>
        <!-- End .clear -->
        <input id="LocationID" type="hidden" value="@Model.Location.ID" />
        <input id="Latitude" type="hidden" value="@Model.Location.Latitude" />
        <input id="Longitude" type="hidden" value="@Model.Location.Longitude" />
        <input id="TimeZone" type="hidden" value="@Model.Location.TimeZone" />
        <input id="Year" type="hidden" value="@DateTime.Now.Year" />
        <input id="Month" type="hidden" value="@Model.Month" />
        <input id="DaysInMonth" type="hidden" value="@DaysInMonth" />
        </form>
    </div>
    <!-- End .content-box-content -->
</div>
<!-- End .content-box -->
@section Scripts {
    <script type="text/javascript" src="@Url.Content("/Scripts/DailyPrayers/PrayTimes.js")"></script>
    <script type="text/javascript" src="@Url.Content("/Scripts/DailyPrayers/createprayer.js")"></script>
}
